function getCookie(name) {
    var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
    return r ? r[1] : undefined;
}


$(function () {
    $(".no_merchant button").click(function(){
        $.ajax({
            url: "/web_user_merchant/",
            type: "post",
            contentType: "application/json",
            headers: {
                "X-CSRFToken": getCookie("csrf_token")
            },
            success: function (resp) {
                if (resp.errno == "0") {
                    window.location.reload()
                }else {
                    alert(resp.errmsg)
                }
            }
        })
    })
    $(".merchant_administer").click(function(){
        top.location.href='/merchant_administer/';
    })
})